<extend name="public:base"/>

<block name="left"></block>

<block name="main">

    <div class="detail_header">
        <div class="top_name">
            <a href="{:url('index/invest/index')}" class="goback fl"><i class="iconfont">&#xe600;</i></a>
            <p>{$borrow.borrow_name}</p>
        </div>
        <div class="detail_num">
            <div class="item">
                <p class="num"><span id="rate">{$borrow.borrow_interest_rate}</span>%</p>
                <p>约定收益率</p>
            </div>
        </div>
        <div class="detail_num_loan">
            <p>借款期限：<span>
					{$borrow.borrow_duration}
					</span>天</p>

            <p>还款方式：一次性还本付息</p>
        </div>
    </div>
    <div class="line_bar detail_line_bar">
        <p>最低购买金额：<span id="need">{$borrow.borrow_min}</span> 元</p>
        <div class="pro-bar">
            <div class="process-bar fl">
                <div class="process-bar-hover" style="width:{$borrow.progress|default='72.5'}%"></div>
            </div>
            <p class="fr">{$borrow.progress|default='72.5'}%</p>
            <div class="cl"></div>
        </div>
        <div class="i_marks">
            <!--

                <span>新手专享</span>
                <span>投资上限5万元</span>

            -->
            <!--<span>还款方式：一次性还本付息</span>-->

            <span id="tips">下单成功后，开始计息</span>
            <!--<p class="a999 pt05 small">新手加息奖励仅限首次单笔投资最高5万元</p>-->
        </div>
    </div>
    <ul class="more_about_li">
        <li target="borrow_info">产品详情<i class="iconfont fr a78">&#xe611;</i></li>
        <li target="img_info">产品资料<i class="iconfont fr a78">&#xe611;</i></li>
        <li target="record_list">购买记录<span class="mark">{$borrow.borrow_counts}</span><i class="iconfont fr a78">&#xe611;</i>
        </li>

    </ul>
    <div class="invest_bar">

        <a href="javascript:showInvest();" id="investFrist">立即投资</a>
        <!--<a href="javascript:openBankPopup('#bankCloseBox',true);">立即投资</a>-->

        <!--<a href="{:url('uc/sign/login')}">先登录后投标</a>-->

    </div>
    <div class="investbox" id="investbox">
        <form action="{:url('index/invest/buy')}" method="post" id="investForm">
            {:token()}
            <input type="hidden" name="card_id" value="" id="card_id"/>
            <input type="hidden" name="id" id="borrow_id" value="{$borrow.id}"/>

            <input type="hidden" value="0" id="newerIncrease"> <!-- 加息幅度%  -->
            <input type="hidden" value="0" id="newerMoney"> <!-- 新手加息最大金额  -->
            <input type="hidden" value="0" id="produceType"> <!-- 类型  -->

            <div class="title">投标设置</div>
            <div class="showinvest">
                <div class="account">
                    <p class="fl">可用余额：<b id="mymoney" class="af90">{$account_money}</b> 元</p>
                    <a href="{:url('user/recharge/index')}" class="blue fr">充值</a>
                    <div class="cl"></div>
                </div>
                <div class="investinputbar">
                    <span class="large">¥</span>
                    <input type="tel" name="money" maxlength="10" autocomplete="off"
                           placeholder="请输入{$borrow.borrow_min}元以上投资金额"
                           id="invest_money" value="" onkeyup="checkInvestMoney(this)"/>
                </div>
                <!--<a href="javascript:;" class="usercouponbtm" onclick="movetop('coupon_frame');">
                    <i class="iconfont big fl">&#xe623;</i>
                    <span class="fl">选择红包卡券</span>
                    <i class="iconfont fr">&#xe611;</i>
                    <div class="cl"></div>
                </a>-->
                <!--<div id="plus_txt" class="small pt05 a999 hide"><span style="color: #f60;">*</span>此次加息奖励金将与最后一次还款一并发放</div>-->
                <!--<p class="pt05 a666 small">
                    <span class="fl"><input type="checkbox" name="agree" value="0" id="agree" autocomplete="off" />请您阅读并同意微金在线的</span>
                    <a href="{:url('index/agreement/borrow')}" class="af60 fl">《微金在线网络借款协议》</a>
                    <a href="{:url('index/agreement/esign')}" class="af60 fl">《e签宝用户协议(第三方协议)》</a>
                    <a href="{:url('index/agreement/risk')}" class="af60 fl">《微金在线风险提示告知书》</a>
                    <div class="cl"></div>
                </p>-->
                <input type="submit" value="确认投资" class="invest_now"/>
            </div>
            <div class="close" onclick="closeInvest();"><i class="iconfont">&#xe602;</i></div>

        </form>
    </div>

    <div id="borrow_info" class="openframe hide">
        <div class="mark_bar invest_mark_bar">
            <a href="javascript:;" onclick="movebot('borrow_info');" class="goback fl"><i class="iconfont">&#xe602;</i></a>
            <p>产品详情</p>
        </div>
        <div class="openframe_content">
            <div class="borrow_info">{$borrow.info}</div>
        </div>
    </div>

    <div id="record_list" class="openframe hide">
        <div class="mark_bar invest_mark_bar">
            <a href="javascript:;" onclick="movebot('record_list');" class="goback fl"><i class="iconfont">&#xe602;</i></a>
            <p>投标记录</p>
        </div>
        <div class="openframe_content">
            <notempty name="invest">
                <table border="0" cellspacing="0" cellpadding="0" class="record_list" width="100%">
                    <tr>
                        <th width="30%">购买人</th>
                        <th width="30%">金额(元)</th>
                        <th width="40%">时间</th>
                    </tr>
                    <volist name="invest" id="v">
                        <tr>
                            <td>{$v.user_name}</td>
                            <td>{$v.invest_capital|default='0'}元</td>
                            <td class="small">{$v.create_time}</td>
                        </tr>
                    </volist>
                </table>
                <else/>
                <p class="empty">暂无记录</p>
            </notempty>
        </div>
    </div>

    <div id="img_info" class="openframe hide">
        <div class="mark_bar invest_mark_bar">
            <a href="javascript:;" onclick="movebot('img_info');" class="goback fl"><i class="iconfont">&#xe602;</i></a>
            <p>产品资料</p>
        </div>
        <div class="openframe_content">
            <div id="img_slide">
                <div class="img_slide" id="thumbs">
                    <ul>
                        <notempty name="borrow.updata">
                            <volist name="borrow.updata" id="v">
                                <li>
                                    <a href="{$v.img}" rel="thumb" class="grouppic">
                                        <img src="{$v.img}"/>
                                    </a>
                                </li>
                            </volist>
                        </notempty>
                        <div class="cl"></div>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <div class="tipsbox_bg"></div>
    <div class="f_bar_fix"></div>

</block>

<block name="menu"></block>

<block name="js">

    <link type="text/css" rel="stylesheet" href="__CSS__/touchTouch.css">
    <script type="text/javascript" src="__JS__/touchTouch.jquery.js"></script>
    <script type="text/javascript" src="__JS__/invest.js?v={:config('app_ver')}"></script>
    <script type="text/javascript" src="__JS__/check.js?v={:config('app_ver')}"></script>

    <script type="text/javascript">

        $(function () {

            // countdown('153235689');

            // clickAgree();

            $("#tips").click(function () {
                var txt = "<b>计息规则：</b><br/>" + "1、当日完成下单，当日计息。<br/>" + "2、次日完成下单， 次日计息。<br/>" + "以上规则自平台上线日起生效。"
                layer.open({
                    content: txt
                    , skin: 'footer'
                });
            });

            $("#thumbs a[rel='thumb']").touchTouch();

            $('.more_about_li li').on('click', function () {
                var target = $(this).attr('target');
                movetop(target);
            });

        });
    </script>
    <script type="text/javascript">
        // var need = parseFloat($('#need').html());
        var invest_min = parseFloat($('#need').html());
        // var invest_max = 0;
        // var account = 0;

        $("#investForm").submit(function () {
            var money = isNaN(parseFloat($("#invest_money").val())) ? 0 : parseFloat($("#invest_money").val());
            var _this = $(this);

            if (money < invest_min) {
                wjtips("本标最低投标金额为" + invest_min + "元");
                return false;
            }

           //  var params= {
           //  };
           // invest(params, );

            alert('正在开发中') ;

            return false ;


        });
    </script>
</block>